<?php


abstract class BaseTblDistributor extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $f_id;


	
	protected $f_code;


	
	protected $f_user_id = 0;


	
	protected $f_name;


	
	protected $f_nickname;


	
	protected $f_ic;


	
	protected $f_country;


	
	protected $f_address;


	
	protected $f_postcode;


	
	protected $f_email;


	
	protected $f_contact;


	
	protected $f_gender;


	
	protected $f_dob;


	
	protected $f_bank_name;


	
	protected $f_bank_acc_no;


	
	protected $f_bank_holder_name;


	
	protected $f_parentid = 0;


	
	protected $f_left = 0;


	
	protected $f_right = 0;


	
	protected $f_level = 0;


	
	protected $f_parentid2 = 0;


	
	protected $f_left2 = 0;


	
	protected $f_right2 = 0;


	
	protected $f_leg2 = 0;


	
	protected $f_level2 = 0;


	
	protected $f_placement_datetime;


	
	protected $f_status = 'pending';


	
	protected $f_gap = 0;


	
	protected $f_gap_datetime;


	
	protected $f_active_datetime;


	
	protected $f_created_by = 0;


	
	protected $f_created_datetime;


	
	protected $parent_id;


	
	protected $parent_code;


	
	protected $total_left = 0;


	
	protected $total_right = 0;


	
	protected $tree_level;


	
	protected $tree_structure;


	
	protected $upline_dist_id;


	
	protected $upline_dist_code;


	
	protected $placement_position;


	
	protected $placement_datetime;


	
	protected $active_datetime;


	
	protected $rank_id;


	
	protected $rank_code;


	
	protected $init_rank_id;


	
	protected $init_rank_code;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getFId()
	{

		return $this->f_id;
	}

	
	public function getFCode()
	{

		return $this->f_code;
	}

	
	public function getFUserId()
	{

		return $this->f_user_id;
	}

	
	public function getFName()
	{

		return $this->f_name;
	}

	
	public function getFNickname()
	{

		return $this->f_nickname;
	}

	
	public function getFIc()
	{

		return $this->f_ic;
	}

	
	public function getFCountry()
	{

		return $this->f_country;
	}

	
	public function getFAddress()
	{

		return $this->f_address;
	}

	
	public function getFPostcode()
	{

		return $this->f_postcode;
	}

	
	public function getFEmail()
	{

		return $this->f_email;
	}

	
	public function getFContact()
	{

		return $this->f_contact;
	}

	
	public function getFGender()
	{

		return $this->f_gender;
	}

	
	public function getFDob($format = 'Y-m-d')
	{

		if ($this->f_dob === null || $this->f_dob === '') {
			return null;
		} elseif (!is_int($this->f_dob)) {
						$ts = strtotime($this->f_dob);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [f_dob] as date/time value: " . var_export($this->f_dob, true));
			}
		} else {
			$ts = $this->f_dob;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFBankName()
	{

		return $this->f_bank_name;
	}

	
	public function getFBankAccNo()
	{

		return $this->f_bank_acc_no;
	}

	
	public function getFBankHolderName()
	{

		return $this->f_bank_holder_name;
	}

	
	public function getFParentid()
	{

		return $this->f_parentid;
	}

	
	public function getFLeft()
	{

		return $this->f_left;
	}

	
	public function getFRight()
	{

		return $this->f_right;
	}

	
	public function getFLevel()
	{

		return $this->f_level;
	}

	
	public function getFParentid2()
	{

		return $this->f_parentid2;
	}

	
	public function getFLeft2()
	{

		return $this->f_left2;
	}

	
	public function getFRight2()
	{

		return $this->f_right2;
	}

	
	public function getFLeg2()
	{

		return $this->f_leg2;
	}

	
	public function getFLevel2()
	{

		return $this->f_level2;
	}

	
	public function getFPlacementDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->f_placement_datetime === null || $this->f_placement_datetime === '') {
			return null;
		} elseif (!is_int($this->f_placement_datetime)) {
						$ts = strtotime($this->f_placement_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [f_placement_datetime] as date/time value: " . var_export($this->f_placement_datetime, true));
			}
		} else {
			$ts = $this->f_placement_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFStatus()
	{

		return $this->f_status;
	}

	
	public function getFGap()
	{

		return $this->f_gap;
	}

	
	public function getFGapDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->f_gap_datetime === null || $this->f_gap_datetime === '') {
			return null;
		} elseif (!is_int($this->f_gap_datetime)) {
						$ts = strtotime($this->f_gap_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [f_gap_datetime] as date/time value: " . var_export($this->f_gap_datetime, true));
			}
		} else {
			$ts = $this->f_gap_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFActiveDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->f_active_datetime === null || $this->f_active_datetime === '') {
			return null;
		} elseif (!is_int($this->f_active_datetime)) {
						$ts = strtotime($this->f_active_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [f_active_datetime] as date/time value: " . var_export($this->f_active_datetime, true));
			}
		} else {
			$ts = $this->f_active_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFCreatedBy()
	{

		return $this->f_created_by;
	}

	
	public function getFCreatedDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->f_created_datetime === null || $this->f_created_datetime === '') {
			return null;
		} elseif (!is_int($this->f_created_datetime)) {
						$ts = strtotime($this->f_created_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [f_created_datetime] as date/time value: " . var_export($this->f_created_datetime, true));
			}
		} else {
			$ts = $this->f_created_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getParentId()
	{

		return $this->parent_id;
	}

	
	public function getParentCode()
	{

		return $this->parent_code;
	}

	
	public function getTotalLeft()
	{

		return $this->total_left;
	}

	
	public function getTotalRight()
	{

		return $this->total_right;
	}

	
	public function getTreeLevel()
	{

		return $this->tree_level;
	}

	
	public function getTreeStructure()
	{

		return $this->tree_structure;
	}

	
	public function getUplineDistId()
	{

		return $this->upline_dist_id;
	}

	
	public function getUplineDistCode()
	{

		return $this->upline_dist_code;
	}

	
	public function getPlacementPosition()
	{

		return $this->placement_position;
	}

	
	public function getPlacementDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->placement_datetime === null || $this->placement_datetime === '') {
			return null;
		} elseif (!is_int($this->placement_datetime)) {
						$ts = strtotime($this->placement_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [placement_datetime] as date/time value: " . var_export($this->placement_datetime, true));
			}
		} else {
			$ts = $this->placement_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getActiveDatetime($format = 'Y-m-d H:i:s')
	{

		if ($this->active_datetime === null || $this->active_datetime === '') {
			return null;
		} elseif (!is_int($this->active_datetime)) {
						$ts = strtotime($this->active_datetime);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [active_datetime] as date/time value: " . var_export($this->active_datetime, true));
			}
		} else {
			$ts = $this->active_datetime;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getRankId()
	{

		return $this->rank_id;
	}

	
	public function getRankCode()
	{

		return $this->rank_code;
	}

	
	public function getInitRankId()
	{

		return $this->init_rank_id;
	}

	
	public function getInitRankCode()
	{

		return $this->init_rank_code;
	}

	
	public function setFId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_id !== $v) {
			$this->f_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_ID;
		}

	} 

	
	public function setFCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_code !== $v) {
			$this->f_code = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_CODE;
		}

	} 

	
	public function setFUserId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_user_id !== $v || $v === 0) {
			$this->f_user_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_USER_ID;
		}

	} 

	
	public function setFName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_name !== $v) {
			$this->f_name = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_NAME;
		}

	} 

	
	public function setFNickname($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_nickname !== $v) {
			$this->f_nickname = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_NICKNAME;
		}

	} 

	
	public function setFIc($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_ic !== $v) {
			$this->f_ic = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_IC;
		}

	} 

	
	public function setFCountry($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_country !== $v) {
			$this->f_country = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_COUNTRY;
		}

	} 

	
	public function setFAddress($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_address !== $v) {
			$this->f_address = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_ADDRESS;
		}

	} 

	
	public function setFPostcode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_postcode !== $v) {
			$this->f_postcode = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_POSTCODE;
		}

	} 

	
	public function setFEmail($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_email !== $v) {
			$this->f_email = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_EMAIL;
		}

	} 

	
	public function setFContact($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_contact !== $v) {
			$this->f_contact = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_CONTACT;
		}

	} 

	
	public function setFGender($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_gender !== $v) {
			$this->f_gender = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_GENDER;
		}

	} 

	
	public function setFDob($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [f_dob] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->f_dob !== $ts) {
			$this->f_dob = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::F_DOB;
		}

	} 

	
	public function setFBankName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_bank_name !== $v) {
			$this->f_bank_name = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_BANK_NAME;
		}

	} 

	
	public function setFBankAccNo($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_bank_acc_no !== $v) {
			$this->f_bank_acc_no = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_BANK_ACC_NO;
		}

	} 

	
	public function setFBankHolderName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_bank_holder_name !== $v) {
			$this->f_bank_holder_name = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_BANK_HOLDER_NAME;
		}

	} 

	
	public function setFParentid($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_parentid !== $v || $v === 0) {
			$this->f_parentid = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_PARENTID;
		}

	} 

	
	public function setFLeft($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_left !== $v || $v === 0) {
			$this->f_left = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_LEFT;
		}

	} 

	
	public function setFRight($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_right !== $v || $v === 0) {
			$this->f_right = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_RIGHT;
		}

	} 

	
	public function setFLevel($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_level !== $v || $v === 0) {
			$this->f_level = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_LEVEL;
		}

	} 

	
	public function setFParentid2($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_parentid2 !== $v || $v === 0) {
			$this->f_parentid2 = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_PARENTID2;
		}

	} 

	
	public function setFLeft2($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_left2 !== $v || $v === 0) {
			$this->f_left2 = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_LEFT2;
		}

	} 

	
	public function setFRight2($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_right2 !== $v || $v === 0) {
			$this->f_right2 = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_RIGHT2;
		}

	} 

	
	public function setFLeg2($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_leg2 !== $v || $v === 0) {
			$this->f_leg2 = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_LEG2;
		}

	} 

	
	public function setFLevel2($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_level2 !== $v || $v === 0) {
			$this->f_level2 = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_LEVEL2;
		}

	} 

	
	public function setFPlacementDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [f_placement_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->f_placement_datetime !== $ts) {
			$this->f_placement_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::F_PLACEMENT_DATETIME;
		}

	} 

	
	public function setFStatus($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->f_status !== $v || $v === 'pending') {
			$this->f_status = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_STATUS;
		}

	} 

	
	public function setFGap($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_gap !== $v || $v === 0) {
			$this->f_gap = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_GAP;
		}

	} 

	
	public function setFGapDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [f_gap_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->f_gap_datetime !== $ts) {
			$this->f_gap_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::F_GAP_DATETIME;
		}

	} 

	
	public function setFActiveDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [f_active_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->f_active_datetime !== $ts) {
			$this->f_active_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::F_ACTIVE_DATETIME;
		}

	} 

	
	public function setFCreatedBy($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->f_created_by !== $v || $v === 0) {
			$this->f_created_by = $v;
			$this->modifiedColumns[] = TblDistributorPeer::F_CREATED_BY;
		}

	} 

	
	public function setFCreatedDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [f_created_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->f_created_datetime !== $ts) {
			$this->f_created_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::F_CREATED_DATETIME;
		}

	} 

	
	public function setParentId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->parent_id !== $v) {
			$this->parent_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::PARENT_ID;
		}

	} 

	
	public function setParentCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->parent_code !== $v) {
			$this->parent_code = $v;
			$this->modifiedColumns[] = TblDistributorPeer::PARENT_CODE;
		}

	} 

	
	public function setTotalLeft($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->total_left !== $v || $v === 0) {
			$this->total_left = $v;
			$this->modifiedColumns[] = TblDistributorPeer::TOTAL_LEFT;
		}

	} 

	
	public function setTotalRight($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->total_right !== $v || $v === 0) {
			$this->total_right = $v;
			$this->modifiedColumns[] = TblDistributorPeer::TOTAL_RIGHT;
		}

	} 

	
	public function setTreeLevel($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->tree_level !== $v) {
			$this->tree_level = $v;
			$this->modifiedColumns[] = TblDistributorPeer::TREE_LEVEL;
		}

	} 

	
	public function setTreeStructure($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tree_structure !== $v) {
			$this->tree_structure = $v;
			$this->modifiedColumns[] = TblDistributorPeer::TREE_STRUCTURE;
		}

	} 

	
	public function setUplineDistId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->upline_dist_id !== $v) {
			$this->upline_dist_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::UPLINE_DIST_ID;
		}

	} 

	
	public function setUplineDistCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->upline_dist_code !== $v) {
			$this->upline_dist_code = $v;
			$this->modifiedColumns[] = TblDistributorPeer::UPLINE_DIST_CODE;
		}

	} 

	
	public function setPlacementPosition($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->placement_position !== $v) {
			$this->placement_position = $v;
			$this->modifiedColumns[] = TblDistributorPeer::PLACEMENT_POSITION;
		}

	} 

	
	public function setPlacementDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [placement_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->placement_datetime !== $ts) {
			$this->placement_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::PLACEMENT_DATETIME;
		}

	} 

	
	public function setActiveDatetime($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [active_datetime] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->active_datetime !== $ts) {
			$this->active_datetime = $ts;
			$this->modifiedColumns[] = TblDistributorPeer::ACTIVE_DATETIME;
		}

	} 

	
	public function setRankId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->rank_id !== $v) {
			$this->rank_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::RANK_ID;
		}

	} 

	
	public function setRankCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->rank_code !== $v) {
			$this->rank_code = $v;
			$this->modifiedColumns[] = TblDistributorPeer::RANK_CODE;
		}

	} 

	
	public function setInitRankId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->init_rank_id !== $v) {
			$this->init_rank_id = $v;
			$this->modifiedColumns[] = TblDistributorPeer::INIT_RANK_ID;
		}

	} 

	
	public function setInitRankCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->init_rank_code !== $v) {
			$this->init_rank_code = $v;
			$this->modifiedColumns[] = TblDistributorPeer::INIT_RANK_CODE;
		}

	} 

	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->f_id = $rs->getInt($startcol + 0);

			$this->f_code = $rs->getString($startcol + 1);

			$this->f_user_id = $rs->getInt($startcol + 2);

			$this->f_name = $rs->getString($startcol + 3);

			$this->f_nickname = $rs->getString($startcol + 4);

			$this->f_ic = $rs->getString($startcol + 5);

			$this->f_country = $rs->getString($startcol + 6);

			$this->f_address = $rs->getString($startcol + 7);

			$this->f_postcode = $rs->getString($startcol + 8);

			$this->f_email = $rs->getString($startcol + 9);

			$this->f_contact = $rs->getString($startcol + 10);

			$this->f_gender = $rs->getString($startcol + 11);

			$this->f_dob = $rs->getDate($startcol + 12, null);

			$this->f_bank_name = $rs->getString($startcol + 13);

			$this->f_bank_acc_no = $rs->getString($startcol + 14);

			$this->f_bank_holder_name = $rs->getString($startcol + 15);

			$this->f_parentid = $rs->getInt($startcol + 16);

			$this->f_left = $rs->getInt($startcol + 17);

			$this->f_right = $rs->getInt($startcol + 18);

			$this->f_level = $rs->getInt($startcol + 19);

			$this->f_parentid2 = $rs->getInt($startcol + 20);

			$this->f_left2 = $rs->getInt($startcol + 21);

			$this->f_right2 = $rs->getInt($startcol + 22);

			$this->f_leg2 = $rs->getInt($startcol + 23);

			$this->f_level2 = $rs->getInt($startcol + 24);

			$this->f_placement_datetime = $rs->getTimestamp($startcol + 25, null);

			$this->f_status = $rs->getString($startcol + 26);

			$this->f_gap = $rs->getInt($startcol + 27);

			$this->f_gap_datetime = $rs->getTimestamp($startcol + 28, null);

			$this->f_active_datetime = $rs->getTimestamp($startcol + 29, null);

			$this->f_created_by = $rs->getInt($startcol + 30);

			$this->f_created_datetime = $rs->getTimestamp($startcol + 31, null);

			$this->parent_id = $rs->getInt($startcol + 32);

			$this->parent_code = $rs->getString($startcol + 33);

			$this->total_left = $rs->getInt($startcol + 34);

			$this->total_right = $rs->getInt($startcol + 35);

			$this->tree_level = $rs->getInt($startcol + 36);

			$this->tree_structure = $rs->getString($startcol + 37);

			$this->upline_dist_id = $rs->getInt($startcol + 38);

			$this->upline_dist_code = $rs->getString($startcol + 39);

			$this->placement_position = $rs->getString($startcol + 40);

			$this->placement_datetime = $rs->getTimestamp($startcol + 41, null);

			$this->active_datetime = $rs->getTimestamp($startcol + 42, null);

			$this->rank_id = $rs->getInt($startcol + 43);

			$this->rank_code = $rs->getString($startcol + 44);

			$this->init_rank_id = $rs->getInt($startcol + 45);

			$this->init_rank_code = $rs->getString($startcol + 46);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 47; 
		} catch (Exception $e) {
			throw new PropelException("Error populating TblDistributor object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TblDistributorPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			TblDistributorPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TblDistributorPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = TblDistributorPeer::doInsert($this, $con);
					$affectedRows += 1; 
										 
										 

					$this->setFId($pk);  

					$this->setNew(false);
				} else {
					$affectedRows += TblDistributorPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 

	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = TblDistributorPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TblDistributorPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getFId();
				break;
			case 1:
				return $this->getFCode();
				break;
			case 2:
				return $this->getFUserId();
				break;
			case 3:
				return $this->getFName();
				break;
			case 4:
				return $this->getFNickname();
				break;
			case 5:
				return $this->getFIc();
				break;
			case 6:
				return $this->getFCountry();
				break;
			case 7:
				return $this->getFAddress();
				break;
			case 8:
				return $this->getFPostcode();
				break;
			case 9:
				return $this->getFEmail();
				break;
			case 10:
				return $this->getFContact();
				break;
			case 11:
				return $this->getFGender();
				break;
			case 12:
				return $this->getFDob();
				break;
			case 13:
				return $this->getFBankName();
				break;
			case 14:
				return $this->getFBankAccNo();
				break;
			case 15:
				return $this->getFBankHolderName();
				break;
			case 16:
				return $this->getFParentid();
				break;
			case 17:
				return $this->getFLeft();
				break;
			case 18:
				return $this->getFRight();
				break;
			case 19:
				return $this->getFLevel();
				break;
			case 20:
				return $this->getFParentid2();
				break;
			case 21:
				return $this->getFLeft2();
				break;
			case 22:
				return $this->getFRight2();
				break;
			case 23:
				return $this->getFLeg2();
				break;
			case 24:
				return $this->getFLevel2();
				break;
			case 25:
				return $this->getFPlacementDatetime();
				break;
			case 26:
				return $this->getFStatus();
				break;
			case 27:
				return $this->getFGap();
				break;
			case 28:
				return $this->getFGapDatetime();
				break;
			case 29:
				return $this->getFActiveDatetime();
				break;
			case 30:
				return $this->getFCreatedBy();
				break;
			case 31:
				return $this->getFCreatedDatetime();
				break;
			case 32:
				return $this->getParentId();
				break;
			case 33:
				return $this->getParentCode();
				break;
			case 34:
				return $this->getTotalLeft();
				break;
			case 35:
				return $this->getTotalRight();
				break;
			case 36:
				return $this->getTreeLevel();
				break;
			case 37:
				return $this->getTreeStructure();
				break;
			case 38:
				return $this->getUplineDistId();
				break;
			case 39:
				return $this->getUplineDistCode();
				break;
			case 40:
				return $this->getPlacementPosition();
				break;
			case 41:
				return $this->getPlacementDatetime();
				break;
			case 42:
				return $this->getActiveDatetime();
				break;
			case 43:
				return $this->getRankId();
				break;
			case 44:
				return $this->getRankCode();
				break;
			case 45:
				return $this->getInitRankId();
				break;
			case 46:
				return $this->getInitRankCode();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TblDistributorPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getFId(),
			$keys[1] => $this->getFCode(),
			$keys[2] => $this->getFUserId(),
			$keys[3] => $this->getFName(),
			$keys[4] => $this->getFNickname(),
			$keys[5] => $this->getFIc(),
			$keys[6] => $this->getFCountry(),
			$keys[7] => $this->getFAddress(),
			$keys[8] => $this->getFPostcode(),
			$keys[9] => $this->getFEmail(),
			$keys[10] => $this->getFContact(),
			$keys[11] => $this->getFGender(),
			$keys[12] => $this->getFDob(),
			$keys[13] => $this->getFBankName(),
			$keys[14] => $this->getFBankAccNo(),
			$keys[15] => $this->getFBankHolderName(),
			$keys[16] => $this->getFParentid(),
			$keys[17] => $this->getFLeft(),
			$keys[18] => $this->getFRight(),
			$keys[19] => $this->getFLevel(),
			$keys[20] => $this->getFParentid2(),
			$keys[21] => $this->getFLeft2(),
			$keys[22] => $this->getFRight2(),
			$keys[23] => $this->getFLeg2(),
			$keys[24] => $this->getFLevel2(),
			$keys[25] => $this->getFPlacementDatetime(),
			$keys[26] => $this->getFStatus(),
			$keys[27] => $this->getFGap(),
			$keys[28] => $this->getFGapDatetime(),
			$keys[29] => $this->getFActiveDatetime(),
			$keys[30] => $this->getFCreatedBy(),
			$keys[31] => $this->getFCreatedDatetime(),
			$keys[32] => $this->getParentId(),
			$keys[33] => $this->getParentCode(),
			$keys[34] => $this->getTotalLeft(),
			$keys[35] => $this->getTotalRight(),
			$keys[36] => $this->getTreeLevel(),
			$keys[37] => $this->getTreeStructure(),
			$keys[38] => $this->getUplineDistId(),
			$keys[39] => $this->getUplineDistCode(),
			$keys[40] => $this->getPlacementPosition(),
			$keys[41] => $this->getPlacementDatetime(),
			$keys[42] => $this->getActiveDatetime(),
			$keys[43] => $this->getRankId(),
			$keys[44] => $this->getRankCode(),
			$keys[45] => $this->getInitRankId(),
			$keys[46] => $this->getInitRankCode(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TblDistributorPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setFId($value);
				break;
			case 1:
				$this->setFCode($value);
				break;
			case 2:
				$this->setFUserId($value);
				break;
			case 3:
				$this->setFName($value);
				break;
			case 4:
				$this->setFNickname($value);
				break;
			case 5:
				$this->setFIc($value);
				break;
			case 6:
				$this->setFCountry($value);
				break;
			case 7:
				$this->setFAddress($value);
				break;
			case 8:
				$this->setFPostcode($value);
				break;
			case 9:
				$this->setFEmail($value);
				break;
			case 10:
				$this->setFContact($value);
				break;
			case 11:
				$this->setFGender($value);
				break;
			case 12:
				$this->setFDob($value);
				break;
			case 13:
				$this->setFBankName($value);
				break;
			case 14:
				$this->setFBankAccNo($value);
				break;
			case 15:
				$this->setFBankHolderName($value);
				break;
			case 16:
				$this->setFParentid($value);
				break;
			case 17:
				$this->setFLeft($value);
				break;
			case 18:
				$this->setFRight($value);
				break;
			case 19:
				$this->setFLevel($value);
				break;
			case 20:
				$this->setFParentid2($value);
				break;
			case 21:
				$this->setFLeft2($value);
				break;
			case 22:
				$this->setFRight2($value);
				break;
			case 23:
				$this->setFLeg2($value);
				break;
			case 24:
				$this->setFLevel2($value);
				break;
			case 25:
				$this->setFPlacementDatetime($value);
				break;
			case 26:
				$this->setFStatus($value);
				break;
			case 27:
				$this->setFGap($value);
				break;
			case 28:
				$this->setFGapDatetime($value);
				break;
			case 29:
				$this->setFActiveDatetime($value);
				break;
			case 30:
				$this->setFCreatedBy($value);
				break;
			case 31:
				$this->setFCreatedDatetime($value);
				break;
			case 32:
				$this->setParentId($value);
				break;
			case 33:
				$this->setParentCode($value);
				break;
			case 34:
				$this->setTotalLeft($value);
				break;
			case 35:
				$this->setTotalRight($value);
				break;
			case 36:
				$this->setTreeLevel($value);
				break;
			case 37:
				$this->setTreeStructure($value);
				break;
			case 38:
				$this->setUplineDistId($value);
				break;
			case 39:
				$this->setUplineDistCode($value);
				break;
			case 40:
				$this->setPlacementPosition($value);
				break;
			case 41:
				$this->setPlacementDatetime($value);
				break;
			case 42:
				$this->setActiveDatetime($value);
				break;
			case 43:
				$this->setRankId($value);
				break;
			case 44:
				$this->setRankCode($value);
				break;
			case 45:
				$this->setInitRankId($value);
				break;
			case 46:
				$this->setInitRankCode($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TblDistributorPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setFId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setFCode($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setFUserId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setFName($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setFNickname($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setFIc($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setFCountry($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setFAddress($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setFPostcode($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setFEmail($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setFContact($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setFGender($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setFDob($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setFBankName($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setFBankAccNo($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setFBankHolderName($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setFParentid($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setFLeft($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setFRight($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setFLevel($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setFParentid2($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setFLeft2($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setFRight2($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setFLeg2($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setFLevel2($arr[$keys[24]]);
		if (array_key_exists($keys[25], $arr)) $this->setFPlacementDatetime($arr[$keys[25]]);
		if (array_key_exists($keys[26], $arr)) $this->setFStatus($arr[$keys[26]]);
		if (array_key_exists($keys[27], $arr)) $this->setFGap($arr[$keys[27]]);
		if (array_key_exists($keys[28], $arr)) $this->setFGapDatetime($arr[$keys[28]]);
		if (array_key_exists($keys[29], $arr)) $this->setFActiveDatetime($arr[$keys[29]]);
		if (array_key_exists($keys[30], $arr)) $this->setFCreatedBy($arr[$keys[30]]);
		if (array_key_exists($keys[31], $arr)) $this->setFCreatedDatetime($arr[$keys[31]]);
		if (array_key_exists($keys[32], $arr)) $this->setParentId($arr[$keys[32]]);
		if (array_key_exists($keys[33], $arr)) $this->setParentCode($arr[$keys[33]]);
		if (array_key_exists($keys[34], $arr)) $this->setTotalLeft($arr[$keys[34]]);
		if (array_key_exists($keys[35], $arr)) $this->setTotalRight($arr[$keys[35]]);
		if (array_key_exists($keys[36], $arr)) $this->setTreeLevel($arr[$keys[36]]);
		if (array_key_exists($keys[37], $arr)) $this->setTreeStructure($arr[$keys[37]]);
		if (array_key_exists($keys[38], $arr)) $this->setUplineDistId($arr[$keys[38]]);
		if (array_key_exists($keys[39], $arr)) $this->setUplineDistCode($arr[$keys[39]]);
		if (array_key_exists($keys[40], $arr)) $this->setPlacementPosition($arr[$keys[40]]);
		if (array_key_exists($keys[41], $arr)) $this->setPlacementDatetime($arr[$keys[41]]);
		if (array_key_exists($keys[42], $arr)) $this->setActiveDatetime($arr[$keys[42]]);
		if (array_key_exists($keys[43], $arr)) $this->setRankId($arr[$keys[43]]);
		if (array_key_exists($keys[44], $arr)) $this->setRankCode($arr[$keys[44]]);
		if (array_key_exists($keys[45], $arr)) $this->setInitRankId($arr[$keys[45]]);
		if (array_key_exists($keys[46], $arr)) $this->setInitRankCode($arr[$keys[46]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(TblDistributorPeer::DATABASE_NAME);

		if ($this->isColumnModified(TblDistributorPeer::F_ID)) $criteria->add(TblDistributorPeer::F_ID, $this->f_id);
		if ($this->isColumnModified(TblDistributorPeer::F_CODE)) $criteria->add(TblDistributorPeer::F_CODE, $this->f_code);
		if ($this->isColumnModified(TblDistributorPeer::F_USER_ID)) $criteria->add(TblDistributorPeer::F_USER_ID, $this->f_user_id);
		if ($this->isColumnModified(TblDistributorPeer::F_NAME)) $criteria->add(TblDistributorPeer::F_NAME, $this->f_name);
		if ($this->isColumnModified(TblDistributorPeer::F_NICKNAME)) $criteria->add(TblDistributorPeer::F_NICKNAME, $this->f_nickname);
		if ($this->isColumnModified(TblDistributorPeer::F_IC)) $criteria->add(TblDistributorPeer::F_IC, $this->f_ic);
		if ($this->isColumnModified(TblDistributorPeer::F_COUNTRY)) $criteria->add(TblDistributorPeer::F_COUNTRY, $this->f_country);
		if ($this->isColumnModified(TblDistributorPeer::F_ADDRESS)) $criteria->add(TblDistributorPeer::F_ADDRESS, $this->f_address);
		if ($this->isColumnModified(TblDistributorPeer::F_POSTCODE)) $criteria->add(TblDistributorPeer::F_POSTCODE, $this->f_postcode);
		if ($this->isColumnModified(TblDistributorPeer::F_EMAIL)) $criteria->add(TblDistributorPeer::F_EMAIL, $this->f_email);
		if ($this->isColumnModified(TblDistributorPeer::F_CONTACT)) $criteria->add(TblDistributorPeer::F_CONTACT, $this->f_contact);
		if ($this->isColumnModified(TblDistributorPeer::F_GENDER)) $criteria->add(TblDistributorPeer::F_GENDER, $this->f_gender);
		if ($this->isColumnModified(TblDistributorPeer::F_DOB)) $criteria->add(TblDistributorPeer::F_DOB, $this->f_dob);
		if ($this->isColumnModified(TblDistributorPeer::F_BANK_NAME)) $criteria->add(TblDistributorPeer::F_BANK_NAME, $this->f_bank_name);
		if ($this->isColumnModified(TblDistributorPeer::F_BANK_ACC_NO)) $criteria->add(TblDistributorPeer::F_BANK_ACC_NO, $this->f_bank_acc_no);
		if ($this->isColumnModified(TblDistributorPeer::F_BANK_HOLDER_NAME)) $criteria->add(TblDistributorPeer::F_BANK_HOLDER_NAME, $this->f_bank_holder_name);
		if ($this->isColumnModified(TblDistributorPeer::F_PARENTID)) $criteria->add(TblDistributorPeer::F_PARENTID, $this->f_parentid);
		if ($this->isColumnModified(TblDistributorPeer::F_LEFT)) $criteria->add(TblDistributorPeer::F_LEFT, $this->f_left);
		if ($this->isColumnModified(TblDistributorPeer::F_RIGHT)) $criteria->add(TblDistributorPeer::F_RIGHT, $this->f_right);
		if ($this->isColumnModified(TblDistributorPeer::F_LEVEL)) $criteria->add(TblDistributorPeer::F_LEVEL, $this->f_level);
		if ($this->isColumnModified(TblDistributorPeer::F_PARENTID2)) $criteria->add(TblDistributorPeer::F_PARENTID2, $this->f_parentid2);
		if ($this->isColumnModified(TblDistributorPeer::F_LEFT2)) $criteria->add(TblDistributorPeer::F_LEFT2, $this->f_left2);
		if ($this->isColumnModified(TblDistributorPeer::F_RIGHT2)) $criteria->add(TblDistributorPeer::F_RIGHT2, $this->f_right2);
		if ($this->isColumnModified(TblDistributorPeer::F_LEG2)) $criteria->add(TblDistributorPeer::F_LEG2, $this->f_leg2);
		if ($this->isColumnModified(TblDistributorPeer::F_LEVEL2)) $criteria->add(TblDistributorPeer::F_LEVEL2, $this->f_level2);
		if ($this->isColumnModified(TblDistributorPeer::F_PLACEMENT_DATETIME)) $criteria->add(TblDistributorPeer::F_PLACEMENT_DATETIME, $this->f_placement_datetime);
		if ($this->isColumnModified(TblDistributorPeer::F_STATUS)) $criteria->add(TblDistributorPeer::F_STATUS, $this->f_status);
		if ($this->isColumnModified(TblDistributorPeer::F_GAP)) $criteria->add(TblDistributorPeer::F_GAP, $this->f_gap);
		if ($this->isColumnModified(TblDistributorPeer::F_GAP_DATETIME)) $criteria->add(TblDistributorPeer::F_GAP_DATETIME, $this->f_gap_datetime);
		if ($this->isColumnModified(TblDistributorPeer::F_ACTIVE_DATETIME)) $criteria->add(TblDistributorPeer::F_ACTIVE_DATETIME, $this->f_active_datetime);
		if ($this->isColumnModified(TblDistributorPeer::F_CREATED_BY)) $criteria->add(TblDistributorPeer::F_CREATED_BY, $this->f_created_by);
		if ($this->isColumnModified(TblDistributorPeer::F_CREATED_DATETIME)) $criteria->add(TblDistributorPeer::F_CREATED_DATETIME, $this->f_created_datetime);
		if ($this->isColumnModified(TblDistributorPeer::PARENT_ID)) $criteria->add(TblDistributorPeer::PARENT_ID, $this->parent_id);
		if ($this->isColumnModified(TblDistributorPeer::PARENT_CODE)) $criteria->add(TblDistributorPeer::PARENT_CODE, $this->parent_code);
		if ($this->isColumnModified(TblDistributorPeer::TOTAL_LEFT)) $criteria->add(TblDistributorPeer::TOTAL_LEFT, $this->total_left);
		if ($this->isColumnModified(TblDistributorPeer::TOTAL_RIGHT)) $criteria->add(TblDistributorPeer::TOTAL_RIGHT, $this->total_right);
		if ($this->isColumnModified(TblDistributorPeer::TREE_LEVEL)) $criteria->add(TblDistributorPeer::TREE_LEVEL, $this->tree_level);
		if ($this->isColumnModified(TblDistributorPeer::TREE_STRUCTURE)) $criteria->add(TblDistributorPeer::TREE_STRUCTURE, $this->tree_structure);
		if ($this->isColumnModified(TblDistributorPeer::UPLINE_DIST_ID)) $criteria->add(TblDistributorPeer::UPLINE_DIST_ID, $this->upline_dist_id);
		if ($this->isColumnModified(TblDistributorPeer::UPLINE_DIST_CODE)) $criteria->add(TblDistributorPeer::UPLINE_DIST_CODE, $this->upline_dist_code);
		if ($this->isColumnModified(TblDistributorPeer::PLACEMENT_POSITION)) $criteria->add(TblDistributorPeer::PLACEMENT_POSITION, $this->placement_position);
		if ($this->isColumnModified(TblDistributorPeer::PLACEMENT_DATETIME)) $criteria->add(TblDistributorPeer::PLACEMENT_DATETIME, $this->placement_datetime);
		if ($this->isColumnModified(TblDistributorPeer::ACTIVE_DATETIME)) $criteria->add(TblDistributorPeer::ACTIVE_DATETIME, $this->active_datetime);
		if ($this->isColumnModified(TblDistributorPeer::RANK_ID)) $criteria->add(TblDistributorPeer::RANK_ID, $this->rank_id);
		if ($this->isColumnModified(TblDistributorPeer::RANK_CODE)) $criteria->add(TblDistributorPeer::RANK_CODE, $this->rank_code);
		if ($this->isColumnModified(TblDistributorPeer::INIT_RANK_ID)) $criteria->add(TblDistributorPeer::INIT_RANK_ID, $this->init_rank_id);
		if ($this->isColumnModified(TblDistributorPeer::INIT_RANK_CODE)) $criteria->add(TblDistributorPeer::INIT_RANK_CODE, $this->init_rank_code);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(TblDistributorPeer::DATABASE_NAME);

		$criteria->add(TblDistributorPeer::F_ID, $this->f_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getFId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setFId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setFCode($this->f_code);

		$copyObj->setFUserId($this->f_user_id);

		$copyObj->setFName($this->f_name);

		$copyObj->setFNickname($this->f_nickname);

		$copyObj->setFIc($this->f_ic);

		$copyObj->setFCountry($this->f_country);

		$copyObj->setFAddress($this->f_address);

		$copyObj->setFPostcode($this->f_postcode);

		$copyObj->setFEmail($this->f_email);

		$copyObj->setFContact($this->f_contact);

		$copyObj->setFGender($this->f_gender);

		$copyObj->setFDob($this->f_dob);

		$copyObj->setFBankName($this->f_bank_name);

		$copyObj->setFBankAccNo($this->f_bank_acc_no);

		$copyObj->setFBankHolderName($this->f_bank_holder_name);

		$copyObj->setFParentid($this->f_parentid);

		$copyObj->setFLeft($this->f_left);

		$copyObj->setFRight($this->f_right);

		$copyObj->setFLevel($this->f_level);

		$copyObj->setFParentid2($this->f_parentid2);

		$copyObj->setFLeft2($this->f_left2);

		$copyObj->setFRight2($this->f_right2);

		$copyObj->setFLeg2($this->f_leg2);

		$copyObj->setFLevel2($this->f_level2);

		$copyObj->setFPlacementDatetime($this->f_placement_datetime);

		$copyObj->setFStatus($this->f_status);

		$copyObj->setFGap($this->f_gap);

		$copyObj->setFGapDatetime($this->f_gap_datetime);

		$copyObj->setFActiveDatetime($this->f_active_datetime);

		$copyObj->setFCreatedBy($this->f_created_by);

		$copyObj->setFCreatedDatetime($this->f_created_datetime);

		$copyObj->setParentId($this->parent_id);

		$copyObj->setParentCode($this->parent_code);

		$copyObj->setTotalLeft($this->total_left);

		$copyObj->setTotalRight($this->total_right);

		$copyObj->setTreeLevel($this->tree_level);

		$copyObj->setTreeStructure($this->tree_structure);

		$copyObj->setUplineDistId($this->upline_dist_id);

		$copyObj->setUplineDistCode($this->upline_dist_code);

		$copyObj->setPlacementPosition($this->placement_position);

		$copyObj->setPlacementDatetime($this->placement_datetime);

		$copyObj->setActiveDatetime($this->active_datetime);

		$copyObj->setRankId($this->rank_id);

		$copyObj->setRankCode($this->rank_code);

		$copyObj->setInitRankId($this->init_rank_id);

		$copyObj->setInitRankCode($this->init_rank_code);


		$copyObj->setNew(true);

		$copyObj->setFId(NULL); 

	}

	
	public function copy($deepCopy = false)
	{
		
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new TblDistributorPeer();
		}
		return self::$peer;
	}

} 